package com.jmlee.service.impl;

import com.jmlee.avo.ChooseSelectVo;
import com.jmlee.avo.CouponVo;
import com.jmlee.mapper.ACouponMapper;
import com.jmlee.pojo.ACategory;
import com.jmlee.pojo.ACoupon;
import com.jmlee.pojo.AItem;
import com.jmlee.pojo.Acarousel;
import com.jmlee.service.CouponService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author： 郑锦涛
 * @data： 2021/3/20 14:30
 * @version：1.0
 * @描述： 优惠券CouponService实现层
 */
@Service
public class CouponServiceImpl implements CouponService {

    @Autowired
    ACouponMapper aCouponMapper;

    @Override
    public List<ACoupon> couponTable(CouponVo couponVo, RowBounds rowBounds) {
        return aCouponMapper.selectCoupon(couponVo,rowBounds);
    }

    @Override
    public Integer couponTableCount(CouponVo couponVo) {
        return aCouponMapper.couponTableCount(couponVo);
    }

    @Override
    public Integer couponAdd(ACoupon aCoupon) {
        return aCouponMapper.couponAdd(aCoupon);
    }

    @Override
    public List<ChooseSelectVo> getCatId() {
        return aCouponMapper.getCatId();
    }

    @Override
    public List<ChooseSelectVo> getItem() {
        return aCouponMapper.getItem();
    }

    @Override
    public Integer carouselUpload(Acarousel acarousel) {
        return aCouponMapper.carouselUpload(acarousel);
    }

    @Override
    public boolean checkCarouselStatus() {
        Integer byStart = aCouponMapper.changeIsShowByStart();
        Integer byEnd = aCouponMapper.changeIsShowByEnd();
        if (byStart > 0 || byEnd > 0){
            return true;
        }
        return false;
    }
}
